<?php

class Application_Model_ReplyMapper {

    public static function insert($reply) {
        $db = Zend_Registry::get("database");
        $date = array(
            C_CONTENT => $reply->getContent(),
            C_ACCOUNT_ID => $reply->getAccountID(),
            C_PRODUCT_ID => $reply->getProductID()
        );
        $db->insert(T_REPLY, $date);
        return $db->lastInsertId();
    }

    public static function fetchByProductID($productID) {
        $db = Zend_Registry::get("database");
        $result = $db->fetchAll("SELECT EMAIL, CONTENT FROM ACCOUNT, REPLY WHERE ACCOUNT.ID = REPLY.ACCOUNT_ID AND PRODUCT_ID=" . $productID);
        return $result;
    }

}

